package com.example.demo.demos.web;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

@Configuration
public class MyFilterConfig {
    @Bean
    public FilterRegistrationBean<Filter> config(){
        FilterRegistrationBean<Filter> myFilterRegistrationBean = new FilterRegistrationBean<>();
        myFilterRegistrationBean.setFilter(new Myfilter());
        myFilterRegistrationBean.addUrlPatterns("/haha");
        return myFilterRegistrationBean;
    }
}
